package org.jivesoftware.smack.util.dns;

public class HostAddress
{
  private String fqdn;
  private int port;
  private Exception exception;

  public HostAddress(String paramString)
  {
    if (paramString == null)
      throw new IllegalArgumentException("FQDN is null");
    if (paramString.charAt(paramString.length() - 1) == '.')
      this.fqdn = paramString.substring(0, paramString.length() - 1);
    else
      this.fqdn = paramString;
    this.port = 5222;
  }

  public HostAddress(String paramString, int paramInt)
  {
    this(paramString);
    if ((paramInt < 0) || (paramInt > 65535))
      throw new IllegalArgumentException("DNS SRV records weight must be a 16-bit unsiged integer (i.e. between 0-65535. Port was: " + paramInt);
    this.port = paramInt;
  }

  public String getFQDN()
  {
    return this.fqdn;
  }

  public int getPort()
  {
    return this.port;
  }

  public void setException(Exception paramException)
  {
    this.exception = paramException;
  }

  public String toString()
  {
    return this.fqdn + ":" + this.port;
  }

  public boolean equals(Object paramObject)
  {
    if (this == paramObject)
      return true;
    if (!(paramObject instanceof HostAddress))
      return false;
    HostAddress localHostAddress = (HostAddress)paramObject;
    if (!this.fqdn.equals(localHostAddress.fqdn))
      return false;
    return this.port == localHostAddress.port;
  }

  public int hashCode()
  {
    int i = 1;
    i = 37 * i + this.fqdn.hashCode();
    return i * 37 + this.port;
  }

  public String getErrorMessage()
  {
    String str;
    if (this.exception == null)
      str = "No error logged";
    else
      str = this.exception.getMessage();
    return toString() + " Exception: " + str;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.util.dns.HostAddress
 * JD-Core Version:    0.6.1
 */